package com.ldxiwxr.controller.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ldxiwxr.common.common.Result;
import com.ldxiwxr.system.entity.Comment;
import com.ldxiwxr.system.mapper.CommentMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 中药网站评论控制层
 * @author SuBanxia
 */
@RestController
@RequestMapping("/comment")
@Api(tags = "CommentController")
public class CommentController {

    @Autowired
    private CommentMapper commentMapper;
//
//    @ApiOperation("上传评论")
//    @GetMapping("/postComment")
//    public Result<?> postComment(String fileId, String comment, String mail,String name){
//        Comment com = new Comment();
//        com.setFileId(fileId);
//        com.setComment(comment);
//        com.setEmail(mail);
//        com.setName(name);
//        commentMapper.insert(com);
//        return Result.success();
//    }
//
//    @ApiOperation("上传评论")
//    @GetMapping("/getComment")
//    public Result<?> getComment(String fileId){
//        LambdaQueryWrapper<Comment> wrapper = Wrappers.<Comment>lambdaQuery().eq(Comment::getFileId, fileId);
//        List<Comment> commentList = commentMapper.selectList(wrapper);
//        return Result.data(commentList);
//    }
}
